<template>
  <div>
    <ul>
      <li v-for="(item,index) in arr" :key="index" @click="change(index)" :class="{active : index === number}" >
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: ['大学起点', '中专起点', '高中起点'],
      number: 0
    }
  },
  methods: {
    change (index) {
      this.number = index
    }
  }
}
</script>

<style scoped lang="less">
ul {
  list-style: none;
  border-radius: 10px;
  width: 300px;
  overflow: hidden;
  padding: 0;
  li {
    float: left;
    width: 100px;
    height: 40px;
    background-color: #ccc;
    color: #fff;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
  }
  .active {
    background-color: blue;
  }
}
</style>
